1. Field of the Invention
The present invention relates to a data input and output device used for a microcomputer, and more particularly to a data input and output device in which the data transmission and reception is performed by using a timer function.
2. Description of Related Art
In a conventional serial data input and output device, pieces of data are serially transmitted in synchronization with a clock signal output from an internal pre-scaler. In a serial reception, the pieces of data, which are received in synchronization with a clock signal sent from a transmission side, are received and sampled.
FIG. 14 is a block diagram showing the configuration of the conventional data input and output device. In FIG. 14, 100 indicates a pre-scaler for dividing a frequency of a referential clock signal received from a clock oscillating circuit (not shown) to produce a clock signal CLKout of the data transmission and reception. 200 indicates a transmission shift register for transmitting data in synchronization with a clock signal CLKin received from the outside or the clock signal CLKout produced in the pre-scaler 100. 300 indicates a reception shift register for receiving data in synchronization with the clock signal CLKin received from the outside or the clock signal CLKout produced in the pre-scaler 100. 400 indicates a selector for selecting either the clock signal CLKin received from the outside or the clock signal CLKout produced in the pre-scaler 100 and outputting the selected signal to the transmission shift register 200. 500 indicates a selector for selecting either the clock signal CLKin received from the outside or the clock signal CLKout produced in the pre-scaler 100 and outputting the selected signal to the reception shift register 300.
Next, an operation of the conventional data input and output device will be described below.
In this operation, the data transmission and reception performed in synchronization with the clock signal CLKout produced in the pre-scaler 100 is described. In this case, the clock signal CLKout produced in the pre-scaler 100 is selected as a shift clock signal in each of the selectors 400 and 500, and the shift clock signal is output to both the transmission shift register 200 and the reception shift register 300.
FIG. 15 is a timing chart of the data transmission and reception performed in the conventional data input and output device shown in FIG. 14. As shown in FIG. 15, the clock signal CLKout for the data transmission and reception is produced in the pre-scaler 100 in synchronization with a referential clock signal of which a frequency is divided in the pre-scaler 100.
The data transmission is initially described. A shift operation is performed in the transmission shift register 200 at a shift time by using the clock signal CLKout selected in the selector 400, and transmission data Sout is output from the transmission shift register 200. In the example shown in FIG. 15, the transmission data Sout is output from the transmission shift register 200 in synchronization with each trailing edge of the clock signal CLKout.
Next, the data reception is described. Because the data transmission and reception is performed in synchronization with the clock signal CLKout produced in the pre-scaler 100, reception data Sin is transmitted from a transmission side to the conventional data input and output device in synchronization with the clock signal CLKout. In the reception shift register 300, a shift operation is performed at a shift time by using the clock signal CLKout selected in the selector 500, and the reception data Sin is stored in the reception shift register 300. In the example shown in FIG. 15, the reception data Sin is stored in the reception shift register 300 in synchronization with each leading edge of the clock signal CLKout.
Though the pre-scaler 100 has a function for producing the clock signal CLKout for the purpose of the data transmission and reception performed in the data input and output device, the pre-scaler 100 is hardly used for operations using other functions. In contrast, a pre-scaler used in a one chip type microcomputer normally has a timer function as one of peripheral functions, and a referential clock signal or a clock signal transmitted from the outside is counted according to the timer function.
However, because the conventional data input and output device has the above described configuration, in cases where no clock signal sent from the outside is used but the clock signal CLKout produced in the pre-scaler 100 is used for a serial data transmission and reception, there is a problem that there is a probability that the data reception cannot be correctly performed while synchronizing the timing of the data reception with the timing of the data transmission. The problem is described in detail. In cases where data having both a first repetition period of logical values “0” and a second repetition period of logical values “1” different from the first repetition is transmitted from the conventional data input and output device of a transmission side to the conventional data input and output device of a reception side, unless an external clock signal synchronized with the transmission data is used on the reception side, the reception of the transmission data cannot be correctly performed. In other words, the reception of the transmission data cannot be correctly performed on the reception side by using the clock signal CLKout produced in the pre-scaler 100.
Also, the pre-scaler 100 is hardly used for operations other than the production of the clock signal CLKout. Therefore, there is another problem that the pre-scaler 100 is not effectively used for operations using peripheral functions such as a timer function.